/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.game.math.view.action;

import java.awt.Component;
import java.awt.Dialog;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.SwingUtilities;
import org.game.math.view.config.Configure;
import java.util.ResourceBundle;

/**
 *
 * @author nmduc
 */
class PreferenceOKAction(name:String) extends AbstractAction(name) {
  def this() = {
    this(PreferenceOKAction.bundle.getString("item.menu.name"));
  }


  override def actionPerformed(ae:ActionEvent):Unit = {
    Configure.getInstance().updateByTempProperties();
    val dialog:Dialog = SwingUtilities.getRoot(ae.getSource().asInstanceOf[Component]).asInstanceOf[Dialog];
    dialog.setVisible(false);
    dialog.dispose();
    Configure.getInstance().removeTempProperties();
  }
}
object PreferenceOKAction {
  private val bundle:ResourceBundle = ResourceBundle.getBundle("org.game.math.view.action.PreferenceOKAction");
}
